<%@ page pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/base/taglibs.jsp"%>

<html>
	<head>
		<link href="${ctx}/css/main.css" rel="stylesheet" type="text/css" />
	</head>
	<script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>
	<script language="javascript">
		function submitAction(action){
			document.prodForm.action = action ;
			document.prodForm.submit();
		}
		
		function init(){
			document.getElementById("prodName").value = "";
			document.getElementById("infoCategory").value = "";
			document.getElementById("prodType").value ="";
			document.getElementById("createDateFrom").value ="";
			document.getElementById("createDateTo").value ="";
			document.getElementById("endDateFrom").value ="";
			document.getElementById("endDateTo").value ="";
		}
		
		function select(action,id){
			location.href = "${ctx}/" + action + "?id=" + id;
	    }
		
		function doDelete(action,id){
			if(confirm('是否确认删除？')){
				location.href = "${ctx}/" + action + "?id=" + id;
			}
		}
	</script>
	
	<body>
		<form method="post" action="" name="prodForm">
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="20%" class="td2"> 
						信息类别
					</td>
					<td width="30%" class="td2">
						<select name="infoCategory" style="width:200px">
							<option></option>
						    <c:if test="${product.infoCategory == 1}"> 
				    			<option value="1" selected="selected">出售</option>
				    			<option value="2" >求购</option>
				    		</c:if>
				    		<c:if test="${product.infoCategory == 2}">
				    			<option value="1" >出售</option>
				    			<option value="2" selected="selected">求购</option>
				   			</c:if>
				   			<c:if test="${product.infoCategory != 2 && product.infoCategory != 1}">
				    			<option value="1" >出售</option>
				    			<option value="2" >求购</option>
				   			</c:if>
						</select>	
					</td>
					<td width="20%" class="td2">
						商品种类
					</td>
					<td width="30%" class="td2">
					   <select name="prodType" style="width:200px">
					   		<option></option>
					    	<c:forEach var="kindTypeCode" items="${sessionScope.T_kindTypeList}">
						    	<c:if test="${product.prodType == kindTypeCode.typeCode}">
						    		<option value="${kindTypeCode.typeCode}" selected="selected">${kindTypeCode.typeName}</option>
						    	</c:if>
						    	<c:if test="${product.prodType != kindTypeCode.typeCode}">
						    		<option value="${kindTypeCode.typeCode}">${kindTypeCode.typeName}</option>
						    	</c:if>
							</c:forEach>
					   </select>
					</td>
				</tr>
				<tr>
					<td width="20%" class="td2"> 
						商品发布时间（起）
					</td>
					<td width="30%" class="td2">
						<input size="28" readonly="readonly" id="createDateFrom" type="text" name="createDateFrom" value="${product.createDateFrom}"/>
						<img onclick="WdatePicker({el:'createDateFrom'})" src="${ctx}/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<td width="20%" class="td2"> 
						商品发布时间（止）
					</td>
					<td width="30%" class="td2">
						<input size="28" readonly="readonly" id="createDateTo" type="text" name="createDateTo" value="${product.createDateTo}"/>
						<img onclick="WdatePicker({el:'createDateTo'})" src="${ctx}/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<tr>
					<td width="20%" class="td2"> 
						商品截止时间（起）
					</td>
					<td width="30%" class="td2">
						<input size="28" readonly="readonly" id="endDateFrom" type="text" name="endDateFrom" value="${product.endDateFrom}"/>
						<img onclick="WdatePicker({el:'endDateFrom'})" src="${ctx}/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<td width="20%" class="td2"> 
						商品截止时间（止）
					</td>
					<td width="30%" class="td2">
						<input size="28" readonly="readonly" id="endDateTo" type="text" name="endDateTo" value="${product.endDateTo}"/>
						<img onclick="WdatePicker({el:'endDateTo'})" src="${ctx}/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<tr>
					<td width="20%" class="td2"> 
						商品名称
					</td>
					<td width="30%" class="td2">
						<input type="text" name="prodName" size="32" value="${product.prodName}">
					</td>
					<td width="20%" class="td2"> 
						
					</td>
					<td width="30%" class="td2">
					</td>
				</tr>
				<tr>
					<td class="td11" align="left" colspan="4">
						<input type="button" name="find" value="查询" onClick="submitAction('prodFind.ac');">
						&nbsp;&nbsp;<input type="button" name="new" value="新增" onClick="submitAction('prodNew.ac');">
						&nbsp;&nbsp;<input type="button" name="reset" value="重置" onClick="init()">
					</td>
				</tr>
			</table>
			<BR>
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
				    <td width="8%" class="td1" align="center">
						动作
					</td>
					<td width="15%" class="td1" align="center">
						商品名称
					</td>
					<td width="10%" class="td1" align="center">
						商品种类
					</td>
					<td width="8%" class="td1" align="center">
						商品价格
					</td>
					<td width="8%" class="td1" align="center">
						是否热门
					</td>
					<td width="12%" class="td1" align="center">
						商品所有者
					</td>
					<td width="10%" class="td1" align="center">
						发布时间
					</td>
					<td width="10%" class="td1" align="center">
						截止时间
					</td>
					<td width="10%" class="td1" align="center">
						信息类别
					</td>
					<td width="8%" class="td1" align="center">
						删除
					</td>
				</tr>
				<c:forEach var="prod" items="${prodList}">
					<tr>
					    <td class="td2" align="center">
							<a href="javascript:select('prodNew.ac','${prod.id}');">选择</a>
						</td>
						<td class="td2">
							${prod.prodName}
						</td>
						<td class="td2" align="center">
							${prod.prodType}
						</td>
						<td class="td2" align="right">
							${prod.price}
						</td>
						<td class="td2" align="center">
							${prod.hotFlag}
						</td>
						<td class="td2">
							${prod.prodOwner}
						</td>
						<td class="td2" align="center">
							${prod.publishDate}
						</td>
						<td class="td2" align="center">
							${prod.endDate}
						</td>
						<td class="td2" align="center">
							${prod.infoCategory}
						</td>
						<td class="td2" align="center">
							<img src="${ctx}/images/delete0.png" onclick="javascript:doDelete('deleteProd.ac','${prod.id}');">
						</td>
					</tr>
				</c:forEach>
			</table>
		</form>
	</body>
	
	
		
</html>